home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
library.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
16KB
|
263 lines
lllliiiibbbbrrrraaaarrrryyyy((((nnnn)))) TTTTccccllll (((( )))) lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
library - standard library of Tcl procedures
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk _c_m_d
aaaauuuuttttoooo____llllooooaaaadddd _c_m_d
aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx _d_i_r _p_a_t_t_e_r_n _p_a_t_t_e_r_n ...
aaaauuuuttttoooo____rrrreeeesssseeeetttt
ppppaaaarrrrrrrraaaayyyy _a_r_r_a_y_N_a_m_e
uuuunnnnkkkknnnnoooowwwwnnnn _c_m_d ?_a_r_g _a_r_g ...?
_________________________________________________________________
IIIINNNNTTTTRRRROOOODDDDUUUUCCCCTTTTIIIIOOOONNNN
Tcl includes a library of Tcl procedures for commonly-needed
functions. The procedures defined in the Tcl library are
generic ones suitable for use by many different
applications. The location of the Tcl library is returned
by the iiiinnnnffffoooo lllliiiibbbbrrrraaaarrrryyyy command. In addition to the Tcl
library, each application will normally have its own library
of support procedures as well; the location of this library
is normally given by the value of the $$$$_a_p_p____lllliiiibbbbrrrraaaarrrryyyy global
variable, where _a_p_p is the name of the application. For
example, the location of the Tk library is kept in the
variable $$$$ttttkkkk____lllliiiibbbbrrrraaaarrrryyyy.
To access the procedures in the Tcl library, an application
should source the file iiiinnnniiiitttt....ttttccccllll in the library, for example
with the Tcl command
ssssoooouuuurrrrcccceeee [[[[iiiinnnnffffoooo lllliiiibbbbrrrraaaarrrryyyy]]]]////iiiinnnniiiitttt....ttttccccllll
This will define the uuuunnnnkkkknnnnoooowwwwnnnn procedure and arrange for the
other procedures to be loaded on-demand using the auto-load
mechanism defined below.
CCCCOOOOMMMMMMMMAAAANNNNDDDD PPPPRRRROOOOCCCCEEEEDDDDUUUURRRREEEESSSS
The following procedures are provided in the Tcl library:
aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk _c_m_d
Determines whether there is an executable file by the
name _c_m_d. This command examines the directories in the
current search path (given by the PATH enviornment
variable) to see if there is an executable file named
_c_m_d in any of those directories. If so, it returns 1;
if not it returns 0. AAAAuuuuttttoooo____eeeexxxxeeeecccc remembers information
about previous searches in an array named aaaauuuuttttoooo____eeeexxxxeeeeccccssss;
this avoids the path search in future calls for the
same _c_m_d. The command aaaauuuuttttoooo____rrrreeeesssseeeetttt may be used to force
aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk to forget its cached information.
Page 1 (printed 7/17/95)
lllliiiibbbbrrrraaaarrrryyyy((((nnnn)))) TTTTccccllll (((( )))) lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
aaaauuuuttttoooo____llllooooaaaadddd _c_m_d
This command attempts to load the definition for a Tcl
command named _c_m_d. To do this, it searches an _a_u_t_o-
_l_o_a_d _p_a_t_h, which is a list of one or more directories.
The auto-load path is given by the global variable
$$$$aaaauuuuttttoooo____ppppaaaatttthhhh if it exists. If there is no $$$$aaaauuuuttttoooo____ppppaaaatttthhhh
variable, then the TCLLIBPATH environment variable is
used, if it exists. Otherwise the auto-load path
consists of just the Tcl library directory. Within
each directory in the auto-load path there must be a
file ttttccccllllIIIInnnnddddeeeexxxx that describes one or more commands |
defined in that directory and a script to evaluate to |
load each of the commands. The ttttccccllllIIIInnnnddddeeeexxxx file should be |
generated with the aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx command. If _c_m_d is |
found in an index file, then the appropriate script is |
evaluated to create the command. The aaaauuuuttttoooo____llllooooaaaadddd command
returns 1 if _c_m_d was successfully created. The command
returns 0 if there was no index entry for _c_m_d or if the
script didn't actually define _c_m_d (e.g. because index
information is out of date). If an error occurs while
processing the script, then that error is returned.
AAAAuuuuttttoooo____llllooooaaaadddd only reads the index information once and
saves it in the array aaaauuuuttttoooo____iiiinnnnddddeeeexxxx; future calls to
aaaauuuuttttoooo____llllooooaaaadddd check for _c_m_d in the array rather than re-
reading the index files. The cached index information
may be deleted with the command aaaauuuuttttoooo____rrrreeeesssseeeetttt. This will
force the next aaaauuuuttttoooo____llllooooaaaadddd command to reload the index
database from disk.
aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx _d_i_r _p_a_t_t_e_r_n _p_a_t_t_e_r_n ...
Generates an index suitable for use by aaaauuuuttttoooo____llllooooaaaadddd. The |
command searches _d_i_r for all files whose names match |
any of the _p_a_t_t_e_r_n arguments (matching is done with the
gggglllloooobbbb command), generates an index of all the Tcl
command procedures defined in all the matching files,
and stores the index information in a file named
ttttccccllllIIIInnnnddddeeeexxxx in _d_i_r. For example, the command
aaaauuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx ffffoooooooo ****....ttttccccllll
will read all the ....ttttccccllll files in subdirectory ffffoooooooo and
generate a new index file ffffoooooooo////ttttccccllllIIIInnnnddddeeeexxxx.
AAAAuuuuttttoooo____mmmmkkkkiiiinnnnddddeeeexxxx parses the Tcl scripts in a relatively
unsophisticated way: if any line contains the word
pppprrrroooocccc as its first characters then it is assumed to be a
procedure definition and the next word of the line is
taken as the procedure's name. Procedure definitions
that don't appear in this way (e.g. they have spaces
before the pppprrrroooocccc) will not be indexed.
Page 2 (printed 7/17/95)
lllliiiibbbbrrrraaaarrrryyyy((((nnnn)))) TTTTccccllll (((( )))) lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
aaaauuuuttttoooo____rrrreeeesssseeeetttt
Destroys all the information cached by aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk and
aaaauuuuttttoooo____llllooooaaaadddd. This information will be re-read from disk
the next time it is needed. AAAAuuuuttttoooo____rrrreeeesssseeeetttt also deletes
any procedures listed in the auto-load index, so that
fresh copies of them will be loaded the next time that
they're used.
ppppaaaarrrrrrrraaaayyyy _a_r_r_a_y_N_a_m_e
Prints on standard output the names and values of all
the elements in the array _a_r_r_a_y_N_a_m_e. AAAArrrrrrrraaaayyyyNNNNaaaammmmeeee must be
an array accessible to the caller of ppppaaaarrrrrrrraaaayyyy. It may be
either local or global.
uuuunnnnkkkknnnnoooowwwwnnnn _c_m_d ?_a_r_g _a_r_g ...?
This procedure is invoked automatically by the Tcl
interpreter whenever the name of a command doesn't
exist. The uuuunnnnkkkknnnnoooowwwwnnnn procedure receives as its arguments
the name and arguments of the missing command. UUUUnnnnkkkknnnnoooowwwwnnnn |
first calls aaaauuuuttttoooo____llllooooaaaadddd to load the command. If this
succeeds, then it executes the original command with
its original arguments. If the auto-load fails then
uuuunnnnkkkknnnnoooowwwwnnnn calls aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk to see if there is an
executable file by the name _c_m_d. If so, it invokes the
Tcl eeeexxxxeeeecccc command with _c_m_d and all the _a_r_g_s as
arguments. If _c_m_d can't be auto-executed, uuuunnnnkkkknnnnoooowwwwnnnn
checks to see if the command was invoked at top-level
and outside of any script. If so, then uuuunnnnkkkknnnnoooowwwwnnnn takes
takes two additional steps. First, it sees if _c_m_d has
one of the following three forms: !!!!!!!!, !!!!_e_v_e_n_t, or
^^^^_o_l_d^^^^_n_e_w?^^^^?. If so, then uuuunnnnkkkknnnnoooowwwwnnnn carries out history
substitution in the same way that ccccsssshhhh would for these
constructs. Second, and last, uuuunnnnkkkknnnnoooowwwwnnnn checks to see if
_c_m_d is a unique abbreviation for an existing Tcl
command. If so, it expands the command name and
executes the command with the original arguments. If
none of the above efforts has been able to execute the
command, uuuunnnnkkkknnnnoooowwwwnnnn generates an error return. If the
global variable aaaauuuuttttoooo____nnnnoooollllooooaaaadddd is defined, then the auto-
load step is skipped. If the global variable
aaaauuuuttttoooo____nnnnooooeeeexxxxeeeecccc is defined then the auto-exec step is
skipped. Under normal circumstances the return value
from uuuunnnnkkkknnnnoooowwwwnnnn is the return value from the command that
was eventually executed.
VVVVAAAARRRRIIIIAAAABBBBLLLLEEEESSSS
The following global variables are defined or used by the
procedures in the Tcl library:
aaaauuuuttttoooo____eeeexxxxeeeeccccssss
Used by aaaauuuuttttoooo____eeeexxxxeeeeccccooookkkk to record information about whether
Page 3 (printed 7/17/95)
lllliiiibbbbrrrraaaarrrryyyy((((nnnn)))) TTTTccccllll (((( )))) lllliiiibbbbrrrraaaarrrryyyy((((nnnn))))
particular commands exist as executable files.
aaaauuuuttttoooo____iiiinnnnddddeeeexxxx
Used by aaaauuuuttttoooo____llllooooaaaadddd to save the index information read
from disk.
aaaauuuuttttoooo____nnnnooooeeeexxxxeeeecccc
If set to any value, then uuuunnnnkkkknnnnoooowwwwnnnn will not attempt to
auto-exec any commands.
aaaauuuuttttoooo____nnnnoooollllooooaaaadddd
If set to any value, then uuuunnnnkkkknnnnoooowwwwnnnn will not attempt to
auto-load any commands.
aaaauuuuttttoooo____ppppaaaatttthhhh
If set, then it must contain a valid Tcl list giving
directories to search during auto-load operations.
eeeennnnvvvv((((TTTTCCCCLLLL____LLLLIIIIBBBBRRRRAAAARRRRYYYY))))
If set, then it specifies the location of the directory
containing library scripts (the value of this variable
will be returned by the command iiiinnnnffffoooo lllliiiibbbbrrrraaaarrrryyyy). If this
variable isn't set then a default value is used.
eeeennnnvvvv((((TTTTCCCCLLLLLLLLIIIIBBBBPPPPAAAATTTTHHHH))))
If set, then it must contain a valid Tcl list giving
directories to search during auto-load operations.
This variable is only used if aaaauuuuttttoooo____ppppaaaatttthhhh is not defined.
uuuunnnnkkkknnnnoooowwwwnnnn____aaaaccccttttiiiivvvveeee
This variable is set by uuuunnnnkkkknnnnoooowwwwnnnn to indicate that it is
active. It is used to detect errors where uuuunnnnkkkknnnnoooowwwwnnnn
recurses on itself infinitely. The variable is unset
before uuuunnnnkkkknnnnoooowwwwnnnn returns.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
auto-exec, auto-load, library, unknown
Page 4 (printed 7/17/95)